package com.open.capacity.point.feign;

import com.open.capacity.common.auth.details.LoginAppUser;
import com.open.capacity.common.constant.ServiceNameConstant;
import com.open.capacity.common.feign.FeignExceptionConfig;
import com.open.capacity.common.web.Result;
import com.open.capacity.point.feign.fallback.UserFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = ServiceNameConstant.USER, configuration = FeignExceptionConfig.class, fallbackFactory = UserFeignClientFallback.class, decode404 = true)
public interface UserFeignClient {
    @GetMapping(value = "/users/current")
    LoginAppUser getLoginAppUser();

    @PutMapping(value = "/title/updateTitleByUserIdAndPoints")
    Result updateTitleByUserIdAndPoints(@RequestParam("userId") Long userId, @RequestParam("points") Double points, @RequestParam("typeCode") String typeCode);
}
